package biz

import (
	"context"
	"user-server/src/model"
)

type IUserCacheService interface {
	// GetUserInfoByUserName 从缓存中获取用户信息
	GetUserInfoByUserName(ctx context.Context, username string) *model.UserInfo

	//CacheUserInfoByUserName 数据库查询出来的用户信息缓存到redis
	CacheUserInfoByUserName(ctx context.Context, userInfo *model.UserInfo)

	//DelUserInfoByUserName 更新用户信息前后，主动删除缓存信息
	DelUserInfoByUserName(ctx context.Context, username string)
}

var userCacheService IUserCacheService

func RefUserCacheService() IUserCacheService {
	return userCacheService
}

func InjectUserCacheService(impl IUserCacheService) {
	userCacheService = impl
}
